﻿#region Copyright (c) 2009, Brinkhill Oy
/************************************************************************************

Copyright (c) 2009, Brinkhill Oy

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

'***********************************************************************************/
#endregion

using System;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls.WebParts;

using Microsoft.SharePoint.WebPartPages;
using Microsoft.SharePoint;
using System.Reflection;
using System.Diagnostics;

namespace CodePlex.WebParts
{
    /// <summary>
    /// ToolPart that displays logo.
    /// </summary>
    class LogoEditorPart : EditorPart
    {
        string licenseString;

        public LogoEditorPart()
        {
            this.ChromeType = PartChromeType.None;
            licenseString = string.Empty;
        }

        public override void SyncChanges()
        {
        }

        public override bool ApplyChanges()
        {
            return true;
        }

        protected override void Render(HtmlTextWriter writer)
        {
            AdvancedWebPart wp = (AdvancedWebPart)this.WebPartToEdit;

            // Render logo.
            HtmlImage logo = new HtmlImage();

            string logoUrl = SPContext.Current.Web.Url + @"/_layouts/CodePlex/Common/BrinkhillSponsoredBy.png";
            logo.Src = logoUrl;
            logo.Attributes.Add("style", "cursor: pointer");
            logo.Attributes.Add("onClick", @"javascript:window.open('http://www.brinkhill.com/home.aspx?src=awp'); return false");
            logo.RenderControl(writer);
        }
    }
}

